﻿using com.nm.Attributes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaseAPI.model
{
    #region 模块树
    public class ParentModuleData : ModuleData
    {
        [ParamDescription("子类模块")]
        public IList<ParentModuleData> Childrens { get; set; }
    }

    /// <summary>
    /// 平台加载菜单
    /// </summary>
    public class PageModuleList : ModuleData
    {
        [ParamDescription("显示顺序")]
        public int Sort { get; set; }
        
        [ParamDescription("访问地址")]
        public string Url { get; set; }

        [ParamDescription("模块编码")]
        public string ModuleCode { get; set; }

        [ParamDescription("子类模块")]
        public IList<PageModuleList> Childrens { get; set; }
    }

    public class ModuleData
    {
        [ParamDescription("ID")]
        public int ID { get; set; }

        [ParamDescription("模块名称")]
        public string ModuleName { get; set; }

        [ParamDescription("上级模块ID")]
        public int SuperiorModule { get; set; }

        [ParamDescription("等级")]
        public int Grade { get; set; }

        [ParamDescription("模块类型(1-目录;2-页面)")]
        public int Type { get; set; }
    }
    #endregion

    #region 模块数据
    public class ModifyModuleData : CreateModuleData
    {
        [ParamDescription("ID")]
        public int ID { get; set; }
    }

    public class CreateModuleData
    {
        [ParamDescription("模块名称")]
        public string ModuleName { get; set; }

        [ParamDescription("模块编码")]
        public string ModuleCode { get; set; }

        [ParamDescription("上级模块")]
        public int SuperiorModule { get; set; }

        [ParamDescription("等级")]
        public int Grade { get; set; }

        [ParamDescription("模块类型(1-目录;2-页面)")]
        public int Type { get; set; }

        [JsonProperty(NullValueHandling = NullValueHandling.Include)]
        [ParamDescription("显示顺序", DefaultValue =0)]
        public int Sort { get; set; }

        [ParamDescription("是否有效")]
        public bool IsEffective { get; set; }

        [JsonProperty(NullValueHandling = NullValueHandling.Include)]
        [ParamDescription("访问地址",DefaultValue ="")]
        public string Url { get; set; }

        [JsonProperty(NullValueHandling = NullValueHandling.Include)]
        [ParamDescription("说明", DefaultValue = "")]
        public string Memo {
            get;set;
        }
    }
    #endregion
}
